<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
<title>我的消息</title>
<link rel="stylesheet" type="text/css" href="../css/aui-win.css" />
<style>
.add_face{width:15%;}
.messages{width:70%;height:40px;}
input{float:left;height:40px;}
.talk_send,.talk_huifu{width:15%;}
.talk_huifu{display:none;}
.ListDiv{width:100%;margin-bottom:50px;}
.ListDiv li{min-height:95px;list-style:none;border-bottom:1px solid #ccc;padding-top:5px;}
li img{float:left;margin-left:5px;width:90px;}
li .content_li{min-height:95px;margin-left:105px;padding-right:5px;position:relative;}
.talk_word{position:fixed;bottom:0;width:100%;}
.content_li h3{color:black;font-size:16px;font-weight:bold;height:20px;line-height:20px;}
.content_li .timer{font-size:12px;color:#666;height:20px;line-height:20px;}
.content_li .content_p{font-size:14px;color:black;width:100%;float:left;overflow: hidden;text-overflow: ellipsis;display: -webkit-box;-webkit-line-clamp:1;-webkit-box-orient: vertical;}
.content_li .foot{font-size:13px;height:20px;float:right;margin-top:5px;color:#666;}
.foot span{margin:0 10px 0 10px;}
.replay{
	height:100px;
	float:left;
	width:98%;
	display:none;
}
body{
	background:white;
}
.replay textarea{
	width:98%;
	height:60px;
	background:white;
	border:1px solid #00abfd;

}
.replay div{
	width:50px;
	height:25px;
	background:#00abfd;
	line-height:25px;
	text-align:center;
	border-radius:4px;
	color:white;
	font-size:14px;
	float:right;
	margin-right:5px;
}
.shanchu{
	position:absolute;
	right:10px;
	width:20px;
	top:5px;
}
.huifu li{
	height:auto;
}
.huifu{
	margin-right:5px;
	float:right;
	width:95%;
	min-height:1px;
	background:#f5f5f5;
	margin-bottom:5px;
	padding:5px 5px 5px 5px;
	font-size:13px;
	margin-top:13px;
}
.name_huifu,.name_huifu1{
	float:left;
	font-size:13px;
	color:#0f3374;
}
.time_huifu{
	float:right;
	color:#999;
	font-size:11px;
}
.huifu p{
	clear:both;
	margin-bottom:5px;
	color:#333;
}

</style>
</head>
<body>
<div class="div_loding_img">
	数据加载中
</div>
<header class="aui-bar aui-bar-nav aui-bar-yunzo" id="aui-header">
	<a class="aui-btn aui-bar-yunzo aui-pull-left" id="back" onclick="back_go()"> <span class="aui-iconfont aui-icon-left"></span></a>
		<div class="aui-title" id="title">
		 	我的消息
		</div>
	<a class="aui-iconfont aui-icon-menu aui-pull-right" ></a>
</header>
<div class="margin_div"></div>	
<ul class="ListDiv"></ul>
</body>
<script type="text/javascript" src="../script/jquery-1.10.2.min.js" ></script>
<script type="text/javascript" src="../script/common.js" ></script>
<script type="text/javascript">
function select(num){
	if($("#"+num+" .selce").html()=="展开"){
		$("#"+num+" .selce").html("收起")
		$("#"+num+" .selce").css("color","#aaa")
		$("#"+num+" .content_p").css({"height":"auto","overflow":"visible","-webkit-line-clamp":"initial","display":"block"})
	}
	else{
		$("#"+num+" .selce").html("展开")
		$("#"+num+" .content_p").css({"overflow":"hidden","-webkit-line-clamp":"1","display":"-webkit-box"})
	}
}
//获取私信列表
function getInboxList() {
var curCount=0;
var pagesize=100;
var str="";
var sttr="";
var strr="";
var post={"mid":$mid,"did":initdata.get('myinbox'),"groupid":$groupid,"curCount":curCount,"pagesize":pagesize};
ajaxcocRequest('../../api/getmysendinboxinfolistbymid','post',post,function(msg){
	if(msg.code==100){
		if(msg.data.length==0){
			$(".ListDiv").html("<div style='width:20%;margin:40px 0 0 40%;'><img src='../image/gantan.png' style='width:100%;'></div><p style='width:100%;text-align:center;margin-top:30px;color:#999;font-size:18px;'>暂时您没有发送过消息！</p>")
		}
		else{	
			for(var i=0;i<msg.data.length;i++){
				if(msg.data[i].n7.length!=0){
					var reply=msg.data[i].n7;
					for(var j=0;j<reply.length;j++){
						if(reply[j].n1==$mid){
							sttr+='<div class="li_div"><span class="name_huifu">我:</span><span class="time_huifu">'+reply[j].n3+'</span></div><p>'+reply[j].n2+'</p>';
						}
						else{
							sttr+='<div class="li_div"><span class="name_huifu1">'+msg.data[i].n1+':</span><span class="time_huifu">'+reply[j].n3+'</span></div><p>'+reply[j].n2+'</p>';
						}
					}
					str+='<li id="'+msg.data[i].n0+'"><img src="'+msg.data[i].n2+'"><div class="content_li"><img src="../image/shanchu.png" onclick="deletel(\'' + msg.data[i].n0 + '\')" class="shanchu"><h3>'+msg.data[i].n1+'</h3><p class="timer">'+msg.data[i].n5+'</p><p class="content_p">'+msg.data[i].n4+'</p><div class="foot"><span class="selce" onclick="select(\'' + msg.data[i].n0 + '\')">展开</span></div><ul class="huifu">'+sttr+'</ul><div class="replay"><textarea></textarea><div class="btnnn">发送</div></div></div></li>';
					sttr="";
				}
				else{
					str+='<li id="'+msg.data[i].n0+'"><img src="'+msg.data[i].n2+'"><div class="content_li"><img src="../image/shanchu.png" onclick="deletel(\'' + msg.data[i].n0 + '\')" class="shanchu"><h3>'+msg.data[i].n1+'</h3><p class="timer">'+msg.data[i].n5+'</p><p class="content_p">'+msg.data[i].n4+'</p><div class="foot"><span class="selce" onclick="select(\'' + msg.data[i].n0 + '\')">展开</span></div><div class="replay"><textarea></textarea><div class="btnnn">发送</div></div></div></li>';

				}
			}
			$(".ListDiv").html(str);
			$(".selce").css("display","none")
			$(".content_p").each(function(){
				if($(this).text().length>18){
					$(this).siblings(".foot").children(".selce").css("display","inline")
				}
				else{
					$(this).siblings(".foot").children(".selce").css("display","none")
				}
			});
		}
	}
	else{
		alert("请检查您的网络！");
	}
})
}
getInboxList();

function deletel(a){
	var post={"mid":$mid,"did":initdata.get('myinbox'),"groupid":$groupid,"inboxid":a}
	ajaxcocRequest('../../api/delmyinboxinfobyid','post',post,function(msg){
		if(msg.code==100){
			alert("删除成功")
			getInboxList();
		}
		
	})
}

sTart_Stop();
</script>
</html>